I'm using Jython to script in runtime in a plugin based on Java in Eclipse.
When I want to use Python libraries (py_expression_eval, for example) on the scripts, what I'm doing is:
1) install the library using easy_install in Jython standalone (it is installed in: C:\jython2.7.0\Lib\site-packages\py_expression_eval-0.3-py2.7.egg)
2) copy the folder py_expression_eval to C:\eclipse\plugins\org.python.pydev.jython_4.5.5.201603221110\Lib\site-packages
3) in the script, before importing the library, add this folder above to the classpath using sys.path.append()
Is there a way I can install a python library directly to a folder in the classpath, so I could just import the library? What I have in mind is that the Jython standalone has a bin folder with easy_install and pip, but PyDev.Jython does not.
Related
I have the setup as seen in the attached image:
Both the pyd and functions.py file are defined in the same folder yet the error is only at importing pyd file.
The error is ModuleNotFoundError: No module named marketPriceMarcoPolo
I am not sure what is going on.
Edit:
The pyd file was generated on Python 3.7 and is being used on a PC with Python 3.8 installed. Does it matter?
The pyd file was generated on Python 3.7 and is being used on a PC with Python 3.8 installed. Does it matter?
Yes, it matters. It's in the name of the build (.cp37-amd_win64). That means the extension is built for use with CPython 3.7 64-bit on Windows.
Extensions are linked to an explicit Python version. When you run your script on Python 3.8, it will look for marketPriceMarcoPolo.cp38-win_amd64.pyd instead. Build it with the Python you intend to use it with.
We can setup Tensorflow environment in local machine using following options:
Virtualenv
"native" pip
Docker
Anaconda
For using an IDE like PyCharm is recommended by most of all. Is there any proper guideline to setup Tensorflow in PyCharm IDE using any of above environment.
I have done Tensorflow setup in PyCharm IDE using anaconda environment. Here is the step by step details:
First install python in your local machine. I used Anaconda3 environment to install Python.
Then install tensorflow within the anaconda environment
Download and install PyCharm IDE from this link.
Open PyCharm IDE and then create a simple test project
Now go to File -> Settings -> Project Interpreter (Under the Project: Test)
Select path form project interpreter and set the path below for tensorflow environment home/user/anaconda3/envs/tensorflow/bin/python
Then apply and OK.
You can now test and work with tensorflow code as well as python code.
Looking for step-by-step instructions how to integrate Sikulix with Selenium in Pycharm IDE. Would like to combine Sikuli and selenium webdriver for unittesting.
I have already downloaded SikuliX as standalone IDE for Jython2.7. In my Pycharm IDE I have some sikuli packages available. See attached. I do not know which ones to download. Also, still confused if I need to dowload Jython or not.
Please help.
1) Download selenium python bindings from https://pypi.python.org/simple/selenium/
2) Extract that to a folder and run python setup.py install from there.
3) Now, copy the generated "selenium" folder to your \python\Lib and \jython\Lib root directories
4) Test your code by typing "from selenium import webdriver" in your file.
5) For sikuli, just edit your pycharm run configuration and include this in your environment variables "CLASSPATH=C:\Sikuli\sikulixapi.jar;PYTHONUNBUFFERED=1"
6) Use jython as your project interpreter
What is the best strategy to deploy a Perl 6 script which use external modules like LWP::Simple?
For example in Perl we have PAR. Is there are an option in Perl 6 to deploy a self contained script that the user need only to run without bothering himself with installing Rakudo and external Perl 6 modules?
You can create a .jar file and then use java to execute the code. From there, there are plenty of tools to convert a .jar into a binary file (or .exe in Windows).
The syntax for that is:
perl6 --target=jvm --output=your_file.jar your_file.pl6
If that script were the trivial
say "this is running as a .jar file"
You should be able to run java -jar your_file.jar and get
this is running as a .jar file
On macOS, there is a bit of a wrinkle since this feature requires you to build perl6 (Rakudo Star) with Java 1.7+ instead of the Mac's system Java. For this reason the version on your system may not have shipped with JVM support.
If you're using homebrew, here's what you do to fix that:
brew uninstall perl6
brew tap homebrew/versions (so you can install Java 1.7)
brew install Caskroom/versions/java7 (install Java 1.7)
optionally: open a new tab in terminal (you only need to do this if, for some reason, you get an error that Java 1.6 is still in use. )
brew install perl6 --with-jvm (build perl6 with Java Virtual Machine support)
I recently installed OSGEO (http://download.osgeo.org/) which included python and gdal. I just realised however that there are many gdal libraries that were not included in this package for example gdal_merge. How can I install them into the osgeo environment?
Go to this link:
gdal_merge.py
Copy everything and save the script as gdal_merge.py.
Put the gdal_merge.py to the your gdal libraries directory(osgeo directory).
On Windows, in the OSGeo4W setup program, gdal_merge.py and the other GDAL Python scripts are included in the gdal-python package in the Libs Category.
When installed, the Python scripts are copied to the bin subdirectory within the OSGeo4W installation directory along with batch files to launch the Python scripts. (For example, gdal_merge.bat).
Once installed, the GDAL Python scripts can be executed from the OSGeo4W Shell which is available from the Windows Start Menu.