python setup.py install Invalid suntax - python

I am very new to python so please bare with me.
I have downloaded and installed python 3 on my Mac.
I open up an Idle Shell, it begins:
Python 3.9.6 (v3.9.6:db3ff76da1, Jun 28 2021, 11:49:53)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license()" for more information.
>>>
I then type, to change directory to a repo I downloaded from github:
>>> os.chdir("/Users/XXX/Desktop/spotiminder-master")
Then I type:
>>> python setup.py install
as per the instructions, but I get:
>>> SyntaxError: invalid syntax
What do I need to do here? Appreciate your help.

Related

why is pyenv still prioritizing the system's python version when I run `python3.x`?

I have pyenv installed and everything works pretty well except for one aspect: when I run the command python3.9, my system still points to my system's version of python (3.9.13). However, I would like to make it point to my pyenv installed version when running python3.9:
❯ pyenv versions
system
3.7.10
3.8.10
* 3.9.5 (set by /Users/username/.python-version)
❯ python3
Python 3.9.5 (default, Jul 7 2022, 20:35:58)
[Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
❯ python3.9
Python 3.9.13 (main, May 24 2022, 21:13:51)
[Clang 13.1.6 (clang-1316.0.21.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
❯ python3.9 --version
Python 3.9.13
❯ python3 --version
Python 3.9.5
Note that the issue occurs just when running python3.9, not python3.
What's wrong in my configuration?

Syntax error on Mac python 3.8 from pycrypto

I am facing Syntax error on Mac python 3.8 from pycrypto, surprisingly its passing on the linux system,
i know the alternative was proposed to remove pycrypto and install pycryptodome but i didnt get why the above is working on linux and not on mac with the same python version ?
Python 3.8.5 (v3.8.5:580fbb018f, Jul 20 2020, 12:11:27)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Crypto.PublicKey.RSA
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/manish/pyvenv/lib/python3.8/site-packages/Crypto/PublicKey/RSA.py", line 585
except ValueError, IndexError:
^
SyntaxError: invalid syntax
On linux
python
Python 3.8.5 (default, Jul 24 2020, 17:46:42)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import Crypto.PublicKey.RSA
>>>
Pycrypto version 2.6.1
Found the issue. Posting it here for other's reference as i had a hard time figuring out this issue. Thanks to one of my colleague for finding out the below link.
This is because of setuptools version, refer https://github.com/pycrypto/pycrypto/issues/327
after downgrading the setuptools<58.0.0 it is working fine.
Additionally make sure its not picking up the wheel from pip cache so run below steps
pip cache purge
pip uninstall wheel
pip install pycrypto

Can't install Python 2 `gtop` module in virtual environment

I'm trying to run the benchmarks game repo bencher script which was written in python 2 and requires the gtop module, NOT the pygtop module. After searching everywhere and even following their README.md I could not figure out how to get this in my python 2.7.18 virtual environment (created and maintained using pyenv).
I decided to have a look at my system version of python 2.7.18 as I followed the guide from this SO reply and the packages downloaded/installed successfully. My system version of python can import the module just fine:
Python 2.7.18 (default, Mar 8 2021, 13:02:45)
[GCC 9.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gtop
>>> gtop.__file__
'/usr/lib/python2.7/dist-packages/gtk-2.0/gtop.so'
So apparently it comes as a .so which I've researched is like a DLL library for Ubuntu (correct me if I'm wrong)?
Is there a way for me to just copy this into my virtual environment of the same python version?
Thank you to #SamBob for suggesting the SO reply that led to the answer.
What I've been mistakenly doing is copying the gtk-2.0 directory into my virtualenvs site-packages such that:
$HOME/.pyenv/versions/<venv>/lib/python2.7/site-packages/gtk-2.0/gtop.so
What I've done is instead copy just the gtop.so library into the virtualenvs site-packages, and it seemed to recognise it no problem, such that
$HOME/.pyenv/versions/<venv>/lib/python2.7/site-packages/gtop.so
Here is my output now:
Python 2.7.18 (default, Oct 18 2021, 23:18:58)
[GCC 9.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gtop
>>> gtop.__file__
'/home/muffin/.pyenv/versions/project-2.7.18/lib/python2.7/site-packages/gtop.so'
>>>

python: bad interpreter: no such file or directory

I use pyenv to manage python installations but this morning after I installed graphviz with Homebrew any commands which use python started to break with the error bad interpreter: No such file or directory. For example, when I run docker-compose:
/Users/hammer/Library/Python/3.7/bin/docker-compose: /usr/local/opt/python/bin/python3.7: bad interpreter: No such file or directory
It's true that /usr/local/opt/python/bin/python3.7 doesn't exist, but I don't know where this value is configured? What is pointing at it? Python works fine for me otherwise:
% which python
/Users/.../.pyenv/shims/python
% python --version
Python 3.8.5
% python
Python 3.8.5 (default, Jul 21 2020, 10:48:26)
[Clang 11.0.3 (clang-1103.0.32.62)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
I'm running MacOS 10.15.5. I've tried reinstalling pyenv and python

./bin/cqlsh saying python not found

I have installed cassandra 3.0.0 and trying to connect to connect cqlsh. when i try to hit ./bin/cqlsh from the dir of installed cassandra I am getting
python not found. I am using ubunut14.04LTS
when i type python2 in my terminal it says
python2
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
when i type python3 in my terminal it says
python3
Python 3.4.3 (default, Oct 14 2015, 20:28:29)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
so this mean it is already installed . But yes when i type
python in terminal it says
python
The program 'python' is currently not installed. You can install it by typing:
apt-get install python-minimal
even when i install python-minimal it doesn work.
please suggest..
Create a symbolic link /usr/bin/python pointing to either /usr/bin/python2 or /usr/bin/python3

Categories

Resources